<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/restrict/adminHome.xhtml">
	<ui:define name="titulo">
		<h:outputLabel value="MusicBay.com - #{msg.cadastrar} #{msg.musica}" />
	</ui:define>

	<ui:define name="cont">
		<p:messages />
		<p:panel header="#{msg.cadastrar} #{msg.musica}">
			<h:form id="form">
				<h:panelGrid columns="3" cellpadding="7">
					<h:outputLabel value="#{msg.musica}" for="nome" class="label" />
					<h:panelGroup>
						<p:inputText value="#{musicaManagedBean.musica.nome}" id="nome" label="#{msg.nome}" required="true"
							size="30" maxlength="30" requiredMessage="#{msg.nome} #{msg.naoInformado}">
							<f:validateLength minimum="2" maximum="30" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="nome" />

					<h:outputLabel value="#{msg.duracao}" for="duracao" class="label" />
					<h:panelGroup>
						<p:inputText value="#{musicaManagedBean.musica.duracao}" id="duracao" label="#{msg.duracao}"
							required="true" size="4" requiredMessage="#{msg.duracao} #{msg.naoInformado}">
							<f:validateLength minimum="1" maximum="5" />
						</p:inputText>
					</h:panelGroup>
					<p:message for="duracao" />

					<h:outputLabel value="#{msg.faixa}" for="faixa" class="label" />
					<h:panelGroup>
						<p:inputText value="#{musicaManagedBean.musica.faixa}" id="faixa" label="#{msg.faixa}"
							required="true" size="5" requiredMessage="#{msg.invalido}: #{msg.faixa}" maxlength="2">
							<f:validateLength minimum="1" maximum="2" />
						</p:inputText><p/>
						<p:slider for="faixa" maxValue="25" minValue="1" styleClass="slider" />
					</h:panelGroup>
					<p:message for="faixa" />

					<h:outputLabel value="#{msg.album}" for="album1" class="label" />
					<h:panelGroup styleClass="checkBox">
						<p:selectOneMenu id="album1" required="true" value="#{musicaManagedBean.musica.album}"
							requiredMessage="#{msg.album} #{msg.naoInformado}" converter="albumConversor" effect="fade"
							effectDuration="0">
							<f:selectItem itemLabel="#{msg.selecioneAlbum}" itemValue="" />
							<f:selectItems value="#{albumManagedBean.listaAlbuns}" var="album"
								itemLabel="#{album.artista.nome} - *#{album.nome} (#{album.ano})" itemValue="#{album}">
							</f:selectItems>
						</p:selectOneMenu>
					</h:panelGroup>
					<p:message for="album1" />


					<p:commandButton id="showcadastroDialog" value="#{msg.cadastrar}" oncomplete="cadastroDialog.show()"
						icon="ui-icon-check" />
				</h:panelGrid>

				<p:confirmDialog id="cadastroDialog" message="#{msg.confirma} #{msg.cadastro}?"
					header="#{msg.confirma} #{msg.cadastro}?" severity="alert" widgetVar="cadastroDialog">

					<p:commandButton id="confirma" value="#{msg.confirma}" ajax="false"
						actionListener="#{musicaManagedBean.actionSave}" oncomplete="cadastroDialog.hide()"
						icon="ui-icon-check">
					</p:commandButton>
					<p:commandButton id="cancela" value="#{msg.cancelar}" onclick="cadastroDialog.hide()" type="button"
						icon="ui-icon-cancel" />
				</p:confirmDialog>
			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>
</html>

